{***************************************************************
    SpyGestion  Copyright (C) 2008 Christophe KOALI <nature2gas@gmail.com>
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
****************************************************************}
unit modTunnelServeur;

interface

uses Classes,
     ESBDates,
     SysUtils,
     sFonctionsChaines,
     ZlibEx,
     modMimeType,
     modHttpProtocolStatusCode,
     WSocket,
     HttpProt,
     modTunnelSessionId,
     Windows,
     WSocketS;



type

    TTunnelServer = class(TWSocketServer)
    private
        FDossierTunnel: string;

    public

        // renvoi le chemin complet vers un fichier
        function GetFullFile(RelativePath: string): string;

        
    end;
    

implementation

function TTunnelServer.GetFullFile(RelativePath: string): string;
begin
    Result := '';

    if pos('..', RelativePath) > 0 then begin
       exit;
    end;

    Result := sfcFileGetFullDir(FDossierTunnel, RelativePath);

    if pos(FDossierTunnel, Result) < 1 then begin
       // on est descendu dans la racine...
       // impossible car on a interdit la chaine ".." mais bon, peut-être
       // le code hexadécimal a été utilisé
       Result := '';
       exit;
    end;

end;



end.
